package com.hkw.dao.impl;

import com.hkw.dao.ArticleDao;
import com.hkw.domain.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
/**
 * 文章dao接口实现类
 * @Repository将类注册到Spring容器里
 */
@Repository
public class ArticleDaoImpl implements ArticleDao {
    //自动注入
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public void saveArticle(Article article) {
        String sql = "insert into t_article values(null,?,?)";
        jdbcTemplate.update(sql,article.getTitle(),article.getContent());
    }
}
